﻿using System;
using JamesZhao.Engine.Graphics.Effects;
using JamesZhao.Engine.Graphics.Surfaces;
using JamesZhao.Engine.Graphics.Visuals;
using SlimDX.DXGI;

namespace JamesZhao.Engine.Graphics.RenderStages.Old
{
    internal class RenderNormalStage : RenderStage
    {
        public RenderNormalStage(GraphicsDevice device)
        {
            RenderNormalEffect = new GpuProgram(device, "Shaders/RenderNormal.fx");
        }

        public ColorSurface Input { get; set; }

        public GpuProgram RenderNormalEffect { get; set; }

        public override string Name
        {
            get { return "Render Normal"; }
        }

        protected override void OnRender(GraphicsDevice device, SwapChain swapChain, VisualsList visualsList,
                                         Camera camera)
        {
            throw new NotImplementedException();
            //RenderNormalEffect.SetParameter("normalTexture", Input);
            //RenderNormalEffect.SetParameter("normalTextureSize",
            //new Vector2(Input.ActualSize.Width, Input.ActualSize.Height));
            device.ImmediateContext.OutputMerger.SetTargets(FinalDepthSurface.DepthView, FinalColorSurface.TargetView);
            foreach (Drawable renderable in visualsList.Drawables)
            {
                renderable.RenderWithGpuProgram(device, camera, RenderNormalEffect);
            }
        }
    }
}